<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function Star(uname, age) {
        this.uname = uname
        this.age = age
        // this.sing = function () {
        //   console.log('我会唱歌')
        // }
      }
      // a1
      /* Star.prototype.sing = function () {
        console.log('我会唱歌')
      } */

      // a7
      Star.prototype = {
        // a8
        constructor: Star,
        sing: function () {
          console.log('我会唱歌')
        },
        movie: function () {
          console.log('我会演电影')
        }
      }

      var ldh = new Star('理解', 18)
      var zxy = new Star('张佳羽', 19)
      // console.log(Star)
      // a2
      // console.log('a2', ldh)
      // a3
      // console.log('a3', ldh.__proto__ === Star.prototype)

      // a4
      console.log('a4', ldh.__proto__)
      // console.log('a5', ldh.prototype)

      // a5
      // console.log('a6', Star.prototype)

      // a6
      // console.log('a7', ldh.__proto__.constructor)
      // console.log('a8', Star.prototype.constructor)
      // console.log('a9', Star)

      let wuyi = {
        a: 'a',
        b: 'b'
      }
      // console.log('wuyi', wuyi)
      // a9
      console.log('b9', Object.prototype)

    </script>
  </body>
</html>
